// @ts-ignore
/* eslint-disable */
import request from '@/utils/request'

/** 获取指定视频的评论列表 */
export async function getVideoComments(videoId: number) {
  return request<API.BaseResponseCommentList>('/comment/video', {
    method: 'GET',
    params: { videoId },
  })
}

/** 添加评论 */
export async function addComment(body: {
  videoId: number
  userId: number
  content: string
  parentId?: number
  topId?: number
  replyUserId?: number
}) {
  return request<API.BaseResponseLong>('/comment/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  })
}

/** 点赞评论 */
export async function likeComment(commentId: number) {
  return request<API.BaseResponseBoolean>('/comment/like', {
    method: 'POST',
    params: { commentId },
  })
}

/** 点踩评论 */
export async function dislikeComment(commentId: number) {
  return request<API.BaseResponseBoolean>('/comment/dislike', {
    method: 'POST',
    params: { commentId },
  })
}

/** 回复评论 */
export async function replyComment(body: {
  videoId: number
  userId: number
  content: string
  parentId: number
  topId?: number
  replyUserId?: number
}) {
  return request<API.BaseResponseLong>('/comment/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  })
}
